<ul>
<?
    $companies_count = count($this->companies);
    $i = 0;
    foreach ($this->companies as $model_company)
    {
        $i++;
        $expand = (isset($this->expand_company_id)) && ($this->expand_company_id == $model_company->getID());
?>
    <li class="has_content <? if ($i == $companies_count) { echo "last";} ?>">
        <div class="node_pict <?=($expand ? " opened" : "closed")?>" id="accounts_company_<?=$model_company->getID(); ?>" onClick="expandMenu({controller: 'accounts', company_id: <?=$model_company->getID(); ?>, level: EXPAND_ACCOUNTS_IN_COMPANY});"></div>
        <a href= "" onClick="ajaxViewByCompany({id: <?=$model_company->getID(); ?>, action: 'short', container: 'inner', no_apply: true}); return false;"><nobr><?=$model_company->getCaption(); ?></nobr></a>
        <ul id="accounts_company_<?=$model_company->getID(); ?>_content" <? if ($expand) echo "style=\"display: block;\""; ?>>
<?
        if ($expand)
            echo $this->expand;
?>
        </ul>
    </li>
<?
    };
?>
</ul>